hostnamectl set-hostname hdcvm4dh
# 安装依赖
yum install git gcc gcc-c++ ncurses-devel zlib zlib-devel openssl openssl--devel pcre pcre-devel vim lrzsz unzip gcc automake autoconf libtool make libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel numactl libaio perl -y

# 防火墙设置
systemctl restart firewalld.service
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-all

# 新增安装用户
groupadd www-data
useradd -g www-data www-data
groupadd mysql
useradd -r -g mysql mysql

# 安装nginx
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.12.2.tar.gz
tar -zxvf nginx-1.12.2.tar.gz
cd /usr/local/src/nginx-1.12.2
./configure --with-http_ssl_module --with-pcre
make && make install

# 安装php
wget http://cn.php.net/distributions/php-5.6.32.tar.gz
tar zxvf php-5.6.32.tar.gz
cd /usr/local/src/php-5.6.32
./configure --enable-fpm --with-mcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug  --disable-rpath --enable-inline-optimization --with-bz2  --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir --with-openssl
make && make install

# 安装mysql
cd /usr/local/src/
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.21-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.21-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-common-5.7.21-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-5.7.21-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm
yum -y remove mariadb-libs
rpm -ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm
systemctl start mysqld
systemctl enable mysqld
systemctl daemon-reload
systemctl status mysqld
# 显示密码
grep 'temporary password' /var/log/mysqld.log
# 删除密码策略
echo "validate_password = off" >> /etc/my.cnf
echo "user=mysql" >> /etc/my.cnf
echo "bind-address = 0.0.0.0" >> /etc/my.cnf
echo "default-character-set=utf8" >> /etc/my.cnf
echo "default-storage-engine=INNODB" >> /etc/my.cnf
mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '888888';
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "888888";
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '888888' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

systemctl restart mysqld


